import Index from "../pages/Index/Index.vue";

import { createRouter, createWebHashHistory } from 'vue-router'
import Article from "../pages/Article/Article.vue";
import Center from "../pages/Center/Center.vue";
import Individual from "../pages/Center/submenu/Individual.vue";
import Activity from "../pages/Center/submenu/Activity.vue";
import Collect from "../pages/Center/submenu/Collect.vue";
import Report from "../pages/Center/submenu/Report.vue";
import Locus from "../pages/Center/submenu/Locus.vue";
import Due from "../pages/Center/submenu/Due.vue";
import Empty from "../pages/Center/submenu/Empty.vue";
import Theory from "../pages/Theory/Theory.vue";
import Symposia from "../components/textcontent/Symposia.vue";
import Periodical from "../components/textcontent/Periodical.vue";
import Journalism from "../components/textcontent/Journalism.vue";
import Reader from "../components/textcontent/Reader.vue";




const router = createRouter({
    // 4. 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。
    history: createWebHashHistory(),
    routes:[
        {
            path:"/",
            component:Index
        },
        {
            path:"/article",
            component:Article
        },
        {
            path:"/theory",
            component:Theory
        },
        {
            path:"/symposia",
            component:Symposia
        },
        {
            path:"/periodical",
            component:Periodical
        },
        {
            path:"/journalism",
            component:Journalism
        },
        {
            path:"/reader",
            component:Reader
        },
        {
            path:"/center",
            component:Center,
            redirect:to => {
                return {
                    path:"/individual"
                }
            },
            children:[
                {
                    path:"/individual",
                    component:Individual
                },
                {
                    path:"/activity",
                    component:Activity
                },
                {
                    path:"/collect",
                    component:Collect
                },
                {
                    path:"/report",
                    component: Report
                },
                {
                    path:"/locus",
                    component:Locus
                },
                {
                    path:"/due",
                    component:Due
                },
                {
                    path:"/empty",
                    component:Empty
                }


            ]
        }
    ], // `routes: routes` 的缩写
})

router.afterEach(() => {
    // 在每次路由跳转后滚动到页面顶部
    window.scrollTo(0, 0);
})

export default router
